package com.demo.aop;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.demo.service.Demo2Service;
import com.demo.service.DemoService;

/**
 * 
 * @author molly
 * @date 2019年1月11日
 */
public class AspectDemoTest2 {
	private ApplicationContext ctx;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		//ctx = new ClassPathXmlApplicationContext("classpath:application-aop-parent.xml");
		ctx = new ClassPathXmlApplicationContext("classpath:application-aop-parent2.xml");
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void test() {
		DemoService demoService = (DemoService) ctx.getBean("demoService");
		demoService.bisMethod();
		
		Demo2Service demo2Service = (Demo2Service) ctx.getBean("demoService");
		demo2Service.printInfo();
	}

}
